﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace StockHelper.Scripts.Comm
{
    public class Assets
    {
        public static List<Package> packages = new List<Package> { };

        public static Package GetData(string path) {
            foreach (Package i in packages) {
                if (path == i.path || path == i.jsonPath) {
                    return i;
                }
            }
            return null;
        }

    










        /// <summary>
        /// 资源包
        /// </summary>
        public class Package
        {
            public string name;
            public string path;
            public string jsonPath;
            public string voicePath;
            /// <summary>是否官方</summary>
            public bool official = false;
            public Hashtable keys;
            public Hashtable price;
            public Hashtable data;
        }


        public static System.Drawing.Image LoadImg(string path) {
            string pathName = "Assets\\" + path.Replace("/","\\");
            if (!string.IsNullOrEmpty(path) &&  File.Exists(pathName))
                return System.Drawing.Image.FromFile(pathName);
            else {
                return null;
            }
        }
    }
}
